<!DOCTYPE html>
<html lang="th">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <meta http-equiv="content-language" content="th" />
        <meta name="robots" content="index, follow" />
        <meta name="revisit-after" content="3 days" />
        <title><?php echo $title ?></title>
        <link rel="icon" type="image/png" href="<?php echo base_url() ?>img/favicon.png">
        <meta property="og:title" content="<?php echo $title; ?>" />
        <?php
        if (isset($og)) {
            ?>
            <meta property="og:url" content="<?php echo $og['url'] ?>" />
            <meta property="og:image" content="<?php echo $og['image'] ?>" />
            <?php
        } else {
            ?>
            <meta property="og:image" content="http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash3/6672_143708129142739_1262334736_n.jpg" />
            <?php
        }
        ?>
        <meta property="fb:app_id" content="<?php echo FB_APP_ID ?>"/>
        <meta property="fb:admins" content="539921880,701225534"/>

        <?php
        // Add Preset CSS //
        $this->carabiner->css('bootstrap.min.css');
        $this->carabiner->css('font-awesome.min.css');
        $this->carabiner->css('font-awesome-ie7.min.css');
        $this->carabiner->css('custom_bootstrap.css');

        $this->carabiner->css('style.css');
        if (isset($css)) {
            foreach ($css as $row) {
                $this->carabiner->css($row);
            }
        }
        $this->carabiner->display('css');

        // Add Preset JS //
        $this->carabiner->js('jquery.js');
        $this->carabiner->js('bootstrap.min.js');

        if (isset($js)) {
            foreach ($js as $row) {
                $this->carabiner->js($row);
            }
        }
        $this->carabiner->display('js');

        if (isset($js_indy)) {
            foreach ($js_indy as $row) {
                echo '<script src="' . base_url() . 'js/' . $row . '"></script>';
            }
        }
        if (isset($css_indy)) {
            foreach ($css_indy as $row) {
                echo '<link type="text/css" rel="stylesheet" href="' . base_url() . 'css/' . $row . '"></script>';
            }
        }
        ?>


    </head>
    <body>

        <img class="fullscreen-bg"/>

        <div class="container">

            <div class="center-alpha">

            </div>

            <?php echo $main_nav ?>
            <?php echo $content ?>

            <div class="row">
                <div class="span12">
                    <div class="is-block bottom footer" >
                        สนใจลงประกาศการแข่งขันติดต่อได้ที่ <a href="mailto:suwichalala@gmail.com">suwichalala@gmail.com</a> หรือผ่าน Message ใน <a href="http://www.facebook.com/pages/moohooooocom/143308545849364">Fanpage ของเรา</a><br/>
                        Copyright © <?php echo date('Y') . ' ' . WEB_TITLE . '.com' ?>. All rights reserved.
                    </div>
                </div>
            </div>
        </div>

        <div id="fb-root"></div>
        <script>
            function set_background()
            {
                if ($('.sponsor-background').css('background-image') && $('.sponsor-background').css('background-image') != 'none')
                {
                    $('.fullscreen-bg').removeAttr('src');
                    $('.fullscreen-bg').attr('src', $('.sponsor-background').css('background-image').replace('url(', '').replace(')', '').replace('"', '').replace('"', ''));
                }
                else
                {
                    $('.fullscreen-bg').attr('src', '<?php echo base_url() ?>img/bg.jpg');
                }
            }
            set_background();

            /*Prune*/
            setInterval(function() {
                if (Math.ceil(Math.random() * 10) == 1)
                {
                    $.post('<?php echo base_url() ?>ajax/do_prune');
                }
            }, 5000);

            window.fbAsyncInit = function() {
                FB.init({
                    appId: '<?php echo FB_APP_ID ?>',
                    cookie: true,
                    xfbml: true,
                    oauth: true
                });

                FB.Event.subscribe('comment.create', function(response) {
                    if (typeof(do_comment_candidate) != "undefined") {
                        do_comment_candidate(response.href, response.commentID);
                    }
                });
            };
            (function() {
                var e = document.createElement('script');
                e.async = true;
                e.src = document.location.protocol +
                        '//connect.facebook.net/en_US/all.js';
                document.getElementById('fb-root').appendChild(e);
            }());
        </script>

        <script>
            (function(i, s, o, g, r, a, m) {
                i['GoogleAnalyticsObject'] = r;
                i[r] = i[r] || function() {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
                a = s.createElement(o),
                        m = s.getElementsByTagName(o)[0];
                a.async = 1;
                a.src = g;
                m.parentNode.insertBefore(a, m)
            })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

            ga('create', 'UA-39932887-1', 'moohooooo.com');
            ga('send', 'pageview');

        </script>
    </body>
</html>